package com.itheima.mapper;

import com.itheima.entity.YddCate;
import com.itheima.vo.CateVO2;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface YddCateMapper {

    /**
     * 模糊查询
     * @param catename
     * @return
     */
    List<YddCate> selectBycatename(String catename);

    /**
     * 分页查询-全部
     * @return
     */
    List<CateVO2> select();

    /**
     * 查找分类名称相同的个数
     *
     * @param catename
     * @return
     */
    @Select("select COUNT(*) from ydd_cate where catename = #{catename}")
    Integer selectCountByCatename(String catename);

    /**
     * 添加分类
     *
     * @param yddCate
     */
    void insert(YddCate yddCate);

    /**
     * 回显
     *
     * @param id
     * @return
     */
    @Select("select * from ydd_cate where id = #{id}")
    YddCate selectById(Integer id);

    /**
     * 修改
     *
     * @param yddCate
     */
    void update(YddCate yddCate);

    /**
     * 删除
     *
     * @param id
     */
    @Delete("delete from ydd_cate where id = #{id}")
    void delete(Integer id);
}
